package com.threeti.mecool.web.form;

import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.dozer.Mapping;

import com.threeti.mecool.core.domain.model.project.ProjectCategory;
import com.threeti.mecool.framework.util.Lists;
import com.threeti.mecool.framework.web.form.AbstractSearchCriteriaForm;
import com.threeti.mecool.legacy.domain.model.basicdata.CustomerLegacy;

public class ProjectForm extends AbstractSearchCriteriaForm {
  @Mapping("code")
  private String projectCode;
  @Mapping("name")
  private String projectName;
  @Mapping("customer.code")
  private String customerIdSlt;
  @Mapping("managerEmpId")
  private String projectManagerId;
  
  private String startDate;  
  private String endDate;
  
  @Mapping("category.id")
  private String projectCategoryIdSlt;
  @Mapping("description")
  private String projectDescription;

  private List<CustomerLegacy> customers = Lists.newArrayList();
  private List<ProjectCategory> projectCategories = Lists.newArrayList();
  
  public List<ProjectCategory> getProjectCategories() {
    return projectCategories;
  }

  public void setProjectCategories(List<ProjectCategory> projectCategories) {
    this.projectCategories = projectCategories;
  }

  public String getProjectCategoryIdSlt() {
    return projectCategoryIdSlt;
  }

  public void setProjectCategoryIdSlt(String projectCategoryIdSlt) {
    this.projectCategoryIdSlt = projectCategoryIdSlt;
  }

  public String getProjectDescription() {
    return projectDescription;
  }

  public void setProjectDescription(String projectDescription) {
    this.projectDescription = projectDescription;
  }

  public String getProjectCode() {
    return projectCode;
  }

  public void setProjectCode(String projectCode) {
    this.projectCode = projectCode;
  }

  public String getCustomerIdSlt() {
    return customerIdSlt;
  }

  public void setCustomerIdSlt(String customerIdSlt) {
    this.customerIdSlt = customerIdSlt;
  }

  public List<CustomerLegacy> getCustomers() {
    return customers;
  }

  public void setCustomers(List<CustomerLegacy> customers) {
    this.customers = customers;
  }

  public String getProjectName() {
    return projectName;
  }

  public void setProjectName(String projectName) {
    this.projectName = projectName;
  }

  public String getProjectManagerId() {
    return projectManagerId;
  }

  public void setProjectManagerId(String projectManagerId) {
    this.projectManagerId = projectManagerId;
  }

  public String getStartDate() {
    return startDate;
  }

  public void setStartDate(String startDate) {
    this.startDate = startDate;
  }

  public String getEndDate() {
    return endDate;
  }

  public void setEndDate(String endDate) {
    this.endDate = endDate;
  }

  @Override
  public boolean hasAnyConditionInputed() {
    return StringUtils.isNotBlank(projectName) || (StringUtils.isNotBlank(projectCategoryIdSlt) && !projectCategoryIdSlt.equals("-1")) || StringUtils.isNotBlank(projectManagerId);
  }
  
}
